<template>
	<view class="content">
		<!-- 名称 -->
		<view class="bankInfo">
			<view class="name">名称</view>
			<view class="info">{{bankInfo.名称}}</view>
			<view class="copy" @tap="copy(bankInfo.名称)">复制</view>
		</view>
		<!-- 账号 -->
		<view class="bankInfo">
			<view class="name">账号</view>
			<view class="info">{{bankInfo.开户行}}</view>
			<view class="copy" @tap="copy(bankInfo.开户行)">复制</view>
		</view>
		<!-- 开户行 -->
		<view class="bankInfo">
			<view class="name">开户行</view>
			<view class="info">{{bankInfo.账号}}</view>
			<view class="copy" @tap="copy(bankInfo.账号)">复制</view>
		</view>
		<!-- 开户行 -->
		<view class="bankInfo">
			<view class="name">金额</view>
			<view class="info">¥{{money}}</view>
			<view class="copy" @tap="copy(money)">复制</view>
		</view>
		<view class="submit" @tap="goUpload">我已付款，上传打款凭证</view>
	</view>
</template>

<script>
	import { selectConfig } from '../../api/api.js'
	export default {
		data() {
			return {
				bankInfo:'',
				money:''
			}
		},
		onShow() {
			// 获取公司收款账号信息
			this.getBankInfo()
			this.money = uni.getStorageSync('money')
		},
		methods: {
			// 获取公司收款账号信息
			getBankInfo() {
				let data = {
					configKey:'corporate.account'
				}
				selectConfig(data).then( res=> {
					this.bankInfo = res.data
				})
			},
			// 上传打款凭证
			goUpload() {
				uni.navigateTo({
					url:'./uploadVoucher'
				})
			},
			// 复制
			copy(text) {
				uni.setClipboardData({
					data: text,
					success: function () {
						console.log('success');
						uni.showToast({
							title:'复制成功',
							icon:'none'
						})
					}
				});
			}
		}
	}
</script>

<style lang="less">
  .content {
		.bankInfo {
			display: flex;
			align-items: center;
			width: 100%;
			height:110rpx;
			border-bottom: 2px solid #F2F2F2;
			position: relative;
			.name {
				margin-left: 30rpx;
				width: 100rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #000000;
				line-height: 40rpx;
			}
			.info {
				margin-left: 32rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #000000;
				line-height: 40rpx;
			}
			.copy {
				position: absolute;
				right: 30rpx;
				bottom: 30rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #FE3B33;
			}
		}
		.submit {
			margin: 227rpx 0 0 30rpx;
			text-align: center;
			line-height:90rpx ;
			width: 690rpx;
			height: 90rpx;
			background: #FE3B33;
			border-radius: 45rpx;
			font-size: 28rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
		}
	}
</style>
